package com.youpai.platform.wallet.service.mapper;


import com.youpai.platform.wallet.service.entity.po.WalletPO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

/**
 * @date: 2022/7/11 11:16
 * @author: Anna
 * @version: 1.0
 * @description: 账户mapper
 */
@Repository
public interface WalletMapper {

    /**
     * 根据uid查询钱包信息
     *
     * @param uid uid，不能为空，所以接收基础类型
     * @return 钱包信息
     */
    WalletPO selectWalletByUid(@Param(value = "uid") long uid);

    /**
     * 变更coin
     *
     * @param walletId      钱包id
     * @param withdrawCoin    活动获取的coin数量
     * @param onlyEmployCoin 充值获取的coin
     * @return 增加是否成功
     */
    int changeCoin(@Param(value = "walletId") long walletId, @Param(value = "withdrawCoin") long withdrawCoin, @Param(value = "onlyEmployCoin") long onlyEmployCoin);

    /**
     * 注册钱包
     *
     * @param wallet 钱包对象
     * @return 成功条数
     */
    int insertWallet(WalletPO wallet);
}
